#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: season
# @File  : forms.py
# @Date  : 2018/8/22
# @Desc  : form表单处理
from django import forms

from operation.models import UserAsk


class UserAskForm(forms.Form):
    name = forms.CharField(required=True, min_length=2, max_length=20)
    phone = forms.CharField(required=True, min_length=11, max_length=11)
    course_name = forms.CharField(required=True, min_length=5, max_length=5)


# 可以继承字段，也可以新增，挑选字段
# 可以save，调用的是Model的方法，上述Form是不行的
class AnotherUserForm(forms.ModelForm):
    my_field = forms.CharField(required=True, min_length=10, max_length=10)

    class Meta:
        model = UserAsk
        fields = ['name', 'mobile', 'course_name']
